package com.oc.claimobs.bb.facade;

import com.oc.claimobs.bb.dao.FileDao;
import com.oc.claimobs.bb.model.Info;

public class InfoService {

	private static final String BASE_PATH = "file:///store/home/user/settings/";
	private static String DEFAULT_NAME = "reclamos";

	private Persistance dao = new FileDao(BASE_PATH);
	
	public void delete(Integer k) {
		String key = prepareKey(k);
		dao.delete(key);
	}

	public Info getByKey(Integer k) {
		String key = prepareKey(k);
		return (Info)dao.getByKey(key);
	}

	public void saveOrUpdate(Integer k, Object o) {
		String key = prepareKey(k);
		dao.saveOrUpdate(key, o);
	}
	
	private String prepareKey(Integer k){
		String key = DEFAULT_NAME;
		key += "#" + k.toString();
		return key;
	}

	
}
